package se.webbzon.boltzmann.player;

import se.webbzon.boltzmann.game.object.portal.Location;
import se.webbzon.boltzmann.world.RegionEnum;

public class PlayerLocation implements Location, Cloneable {
	
	// The region
	private RegionEnum region;
	
	// The name of the world area
	private String worldAreaName;
	
	// The portal id
	private byte portalId;
	
	/*============================================================
	Constructors
	============================================================*/
	
	/** Creates a new player location. **/
	public PlayerLocation() {
		this(RegionEnum.euler,"euler/r112",(byte) 127);
	}
	
	/** Creates a new player location associated with a region, world area
	 * and a portal. **/
	public PlayerLocation(RegionEnum region, String worldAreaName, byte portalId) {
		this.region = region;
		this.worldAreaName = worldAreaName;
		this.portalId = portalId;
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Sets the player location to the provided location. **/
	public void setLocation(Location location) {
		setRegion(location.getRegion());
		setWorldAreaName(location.getWorldAreaName());
		setPortalId(location.getPortalId());
	}
	
	@Override public RegionEnum getRegion() {
		return region;
	}

	/** Sets the region of the player. **/
	public void setRegion(RegionEnum region) {
		this.region = region;
	}

	@Override  public String getWorldAreaName() {
		return worldAreaName;
	}

	/** Sets the world area name where the player is located. **/
	public void setWorldAreaName(String worldAreaName) {
		this.worldAreaName = worldAreaName;
	}

	@Override public byte getPortalId() {
		return portalId;
	}

	/** Sets the id of the portal associated with the players location. **/
	public void setPortalId(byte portalId) {
		this.portalId = portalId;
	}
	
	@Override public PlayerLocation clone() {
		return new PlayerLocation(region,worldAreaName,portalId);
	}

}
